//
//  KRChoiceCell.m
//  QuickCare
//
//  Created by 张凯锐 on 16/7/13.
//  Copyright © 2016年 lidabiao. All rights reserved.
//

#import "KRChoiceCell.h"

@implementation KRChoiceCell

- (void)setChoice:(KRChoice *)choice {
    _choice = choice;
    if (self.result) {
        NSString *str = choice.ci3_name;
        //找出搜索框文字的位置
        NSRange range = [str rangeOfString:self.searchText];
        //创建富文本
        NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:str];
        //给富文本一段字换颜色
        [attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:range];
        [self.textLabel setAttributedText:attributedStr];
    } else {
        self.textLabel.text = choice.ci3_name;
    }
    
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}

@end
